<template>
  <a-select
    show-search
    option-filter-prop="children"
    :placeholder="$t('pleaseSelect') + $t('vehicleType').toLowerCase()"
    :allow-clean="true"
    :mode="mode"
    :maxTagCount="3"
    v-model="selectedValue"
  >
    <a-select-option v-for="item in releaseNoteLangs" :key="item" :value="item">
      {{ $t(item) }}
    </a-select-option>
  </a-select>
</template>
<script>
import { mapState } from 'vuex'
import { initReleaseNoteLangs as releaseNoteLangs } from '@/config/global'
export default {
  props: {
    defaultValue: {
      type: String,
      default () {
        return 'zh_CN'
      }
    },
    mode: {
      type: String,
      default: 'default'
    }
  },
  computed: {
    ...mapState({
      options: (state) => state.vehicle.types
    })
  },
  data () {
    return {
      selectedValue: 'zh_CN',
      releaseNoteLangs
    }
  },
  watch: {
    defaultValue: {
      handler (val) {
        if (val !== this.selectedValue) {
          this.selectedValue = this.defaultValue
        }
      },
      immediate: true
    },
    selectedValue (val) {
      this.$emit('changeoption', val)
    }
  },
  created () {
  },
  methods: {
  }
}
</script>
